package com.dianping.cat.consumer.problem.model.entity;

import com.dianping.cat.consumer.problem.model.BaseEntity;
import com.dianping.cat.consumer.problem.model.IVisitor;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;




public class Machine
  extends BaseEntity<Machine>
{
  private String m_ip;
/*  17 */   private List<Entry> m_entries = new ArrayList();

/*  19 */   private Map<String, Entity> m_entities = new LinkedHashMap();





  public Machine(String ip) { this.m_ip = ip; }




/*  30 */   public void accept(IVisitor visitor) { visitor.visitMachine(this); }


  public Machine addEntity(Entity entity) {
/*  34 */     this.m_entities.put(entity.getId(), entity);
/*  35 */     return this;
  }

  public Machine addEntry(Entry entry) {
/*  39 */     this.m_entries.add(entry);
/*  40 */     return this;
  }


  public boolean equals(Object obj) {
/*  45 */     if (obj instanceof Machine) {
/*  46 */       Machine _o = (Machine)obj;

/*  48 */       if (!equals(getIp(), _o.getIp())) {
/*  49 */         return false;
      }

/*  52 */       return true;
    }

/*  55 */     return false;
  }


/*  59 */   public Entity findEntity(String id) { return (Entity)this.m_entities.get(id); }


  public Entity findOrCreateEntity(String id) {
/*  63 */     Entity entity = (Entity)this.m_entities.get(id);

/*  65 */     if (entity == null) {
/*  66 */       synchronized (this.m_entities) {
/*  67 */         entity = (Entity)this.m_entities.get(id);

/*  69 */         if (entity == null) {
/*  70 */           entity = new Entity(id);
/*  71 */           this.m_entities.put(id, entity);
        }
      }
    }

/*  76 */     return entity;
  }


/*  80 */   public Map<String, Entity> getEntities() { return this.m_entities; }



/*  84 */   public List<Entry> getEntries() { return this.m_entries; }



/*  88 */   public String getIp() { return this.m_ip; }





/* 102 */   public void mergeAttributes(Machine other) { assertAttributeEquals(other, "machine", "ip", this.m_ip, other.getIp()); }




/* 107 */   public Entity removeEntity(String id) { return (Entity)this.m_entities.remove(id); }


  public Machine setIp(String ip) {
/* 111 */     this.m_ip = ip;
/* 112 */     return this;
  }

  public Machine() {}
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/problem/model/entity/Machine.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */